from ronglian_sms_sdk import SmsSDK
import random
from zbj.my_redis import r
def sms_code(mobile):
        accId = '8aa9'
        accToken = 'e13c2b7cd35645e4300577cedfbfc'
        appId = '8a216da882f1f5942ce11b0'
        sdk = SmsSDK(accId, accToken, appId)
        tid = '1'
        data=random.randint(100000,999999)
        # 存入手机号
        r.set_str("code"+mobile,mobile,60)
        # 存入验证码
        r.set_str(mobile,data,60)
        datas = (data,)
        r.set_str(mobile,data,60)
        resp = sdk.sendMessage(tid, mobile, datas)
        print(resp)
        return resp